<template>
    <div>
        <Table :columns="columns" :data="userInfoData"></Table>

        <Page :total="total" :current="current" :page-size-opts="pageSizeOpts" size="small" show-elevator show-sizer
            show-total @on-change="pageChange" @on-page-size-change="pageSizeChange"></Page>
    </div>
</template>

<script>
    import api from '@/api/apis/common.js'
    export default {
        name: 'UiUserInfo',

        data() {
            return {
                columns: [
                    {
                        title: 'No. ',
                        type: 'index',
                        width: '120'
                    },
                    {
                        title: 'IP',
                        key: 'ip'
                    },
                    {
                        title: '省份',
                        key: 'regionName'
                    },
                    {
                        title: '城市',
                        key: 'city'
                    },
                    {
                        title: '环境',
                        key: 'language'
                    },
                    {
                        title: '网站名称',
                        key: 'systemName'
                    },
                    {
                        title: '访问时间',
                        key: 'createTime'
                    }
                ],
                userInfoData: [],
                pageSizeOpts: [10, 20, 30, 40, 100],
                total: 0,
                current: 1,
                pageSize: 10
            }
        },

        mounted() {
            // this.findList();
        },

        methods: {
            findList() {
                let param = {
                    "current": this.current,
                    "size": this.pageSize
                }
                api.findUserInfo(param).then(res => {
                    this.userInfoData = res.data.data.records
                    this.total = res.data.data.total
                    console.log(res.data);
                })
            },
            pageChange(current) {
                this.current = current;
                this.findList();
            },
            pageSizeChange(pageSize) {
                this.pageSize = pageSize;
                this.findList();
            }
        },
    };
</script>

<style lang="scss" scoped>

</style>